home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / gnu / a2_0bEmacs_bin.lha / Emacs-19.25 / info / emacs-9 (.txt) < prev    next >
GNU Info File  |  1992-02-21  |  49KB  |  873 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.43 from the
  2. input file emacs.tex.
  3.    This file documents the GNU Emacs editor.
  4.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.
  5.    Permission is granted to make and distribute verbatim copies of
  6. this manual provided the copyright notice and this permission notice
  7. are preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  11. General Public License" are included exactly as in the original, and
  12. provided that the entire resulting derived work is distributed under
  13. the terms of a permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "The GNU Manifesto",
  17. "Distribution" and "GNU General Public License" may be included in a
  18. translation approved by the author instead of in the original English.
  19. File: emacs,  Node: Lisp Debug,  Next: Lisp Interaction,  Prev: Lisp Eval,  Up: Running
  20. The Emacs-Lisp Debugger
  21. =======================
  22.    GNU Emacs contains a debugger for Lisp programs executing inside it. 
  23. This debugger is normally not used; many commands frequently get Lisp
  24. errors when invoked in inappropriate contexts (such as `C-f' at the end
  25. of the buffer) and it would be very unpleasant for that to enter a
  26. special debugging mode.  When you want to make Lisp errors invoke the
  27. debugger, you must set the variable `debug-on-error' to non-`nil'. 
  28. Quitting with `C-g' is not considered an error, and `debug-on-error'
  29. has no effect on the handling of `C-g'.  However, if you set
  30. `debug-on-quit' non-`nil', `C-g' will invoke the debugger.  This can
  31. be useful for debugging an infinite loop; type `C-g' once the loop has
  32. had time to reach its steady state.  `debug-on-quit' has no effect on
  33. errors.
  34.    You can also cause the debugger to be entered when a specified
  35. function is called, or at a particular place in Lisp code.  Use `M-x
  36. debug-on-entry' with argument FUN-NAME to cause function FUN-NAME to
  37. enter the debugger as soon as it is called.  Use `M-x
  38. cancel-debug-on-entry' to make the function stop entering the debugger
  39. when called.  (Redefining the function also does this.)  To enter the
  40. debugger from some other place in Lisp code, you must insert the
  41. expression `(debug)' there and install the changed code with `C-M-x'. 
  42. *Note Lisp Eval::.
  43.    When the debugger is entered, it displays the previously selected
  44. buffer in one window and a buffer named `*Backtrace*' in another
  45. window.  The backtrace buffer contains one line for each level of Lisp
  46. function execution currently going on.  At the beginning of this
  47. buffer is a message describing the reason that the debugger was
  48. invoked (such as, what error message if it was invoked due to an
  49. error).
  50.    The backtrace buffer is read-only, and is in a special major mode,
  51. Backtrace mode, in which letters are defined as debugger commands.  The
  52. usual Emacs editing commands are available; you can switch windows to
  53. examine the buffer that was being edited at the time of the error, and
  54. you can also switch buffers, visit files, and do any other sort of
  55. editing.  However, the debugger is a recursive editing level (*note
  56. Recursive Edit::.) and it is wise to go back to the backtrace buffer
  57. and exit the debugger officially when you don't want to use it any
  58. more.  Exiting the debugger kills the backtrace buffer.
  59.    The contents of the backtrace buffer show you the functions that are
  60. executing and the arguments that were given to them.  It has the
  61. additional purpose of allowing you to specify a stack frame by moving
  62. point to the line describing that frame.  The frame whose line point
  63. is on is considered the "current frame".  Some of the debugger
  64. commands operate on the current frame.  Debugger commands are mainly
  65. used for stepping through code an expression at a time.  Here is a
  66. list of them.
  67.      Exit the debugger and continue execution.  In most cases,
  68.      execution of the program continues as if the debugger had never
  69.      been entered (aside from the effect of any variables or data
  70.      structures you may have changed while inside the debugger).  This
  71.      includes entry to the debugger due to function entry or exit,
  72.      explicit invocation, quitting or certain errors.  Most errors
  73.      cannot be continued; trying to continue one of them causes the
  74.      same error to occur again.
  75.      Continue execution, but enter the debugger the next time a Lisp
  76.      function is called.  This allows you to step through the
  77.      subexpressions of an expression, seeing what values the
  78.      subexpressions compute and what else they do.
  79.      The stack frame made for the function call which enters the
  80.      debugger in this way will be flagged automatically for the
  81.      debugger to be called when the frame is exited.  You can use the
  82.      `u' command to cancel this flag.
  83.      Set up to enter the debugger when the current frame is exited. 
  84.      Frames that will invoke the debugger on exit are flagged with
  85.      stars.
  86.      Don't enter the debugger when the current frame is exited.  This
  87.      cancels a `b' command on that frame.
  88.      Read a Lisp expression in the minibuffer, evaluate it, and print
  89.      the value in the echo area.  This is the same as the command
  90.      `M-ESC', except that `e' is not normally disabled like `M-ESC'.
  91.      Terminate the program being debugged; return to top-level Emacs
  92.      command execution.
  93.      If the debugger was entered due to a `C-g' but you really want to
  94.      quit, not to debug, use the `q' command.
  95.      Return a value from the debugger.  The value is computed by
  96.      reading an expression with the minibuffer and evaluating it.
  97.      The value returned by the debugger makes a difference when the
  98.      debugger was invoked due to exit from a Lisp call frame (as
  99.      requested with `b'); then the value specified in the `r' command
  100.      is used as the value of that frame.
  101.      The debugger's return value also matters with many errors.  For
  102.      example, `wrong-type-argument' errors will use the debugger's
  103.      return value instead of the invalid argument; `no-catch' errors
  104.      will use the debugger value as a throw tag instead of the tag
  105.      that was not found.  If an error was signaled by calling the Lisp
  106.      function `signal', the debugger's return value is returned as the
  107.      value of `signal'.
  108. File: emacs,  Node: Lisp Interaction,  Next: External Lisp,  Prev: Lisp Debug,  Up: Running
  109. Lisp Interaction Buffers
  110. ========================
  111.    The buffer `*scratch*' which is selected when Emacs starts up is
  112. provided for evaluating Lisp expressions interactively inside Emacs. 
  113. Both the expressions you evaluate and their output goes in the buffer.
  114.    The `*scratch*' buffer's major mode is Lisp Interaction mode, which
  115. is the same as Emacs-Lisp mode except for one command, LFD.  In
  116. Emacs-Lisp mode, LFD is an indentation command, as usual.  In Lisp
  117. Interaction mode, LFD is bound to `eval-print-last-sexp'.  This
  118. function reads the Lisp expression before point, evaluates it, and
  119. inserts the value in printed representation before point.
  120.    Thus, the way to use the `*scratch*' buffer is to insert Lisp
  121. expressions at the end, ending each one with LFD so that it will be
  122. evaluated.  The result is a complete typescript of the expressions you
  123. have evaluated and their values.
  124.    The rationale for this feature is that Emacs must have a buffer
  125. when it starts up, but that buffer is not useful for editing files
  126. since a new buffer is made for every file that you visit.  The Lisp
  127. interpreter typescript is the most useful thing I can think of for the
  128. initial buffer to do.  `M-x lisp-interaction-mode' will put any buffer
  129. in Lisp Interaction mode.
  130. File: emacs,  Node: External Lisp,  Prev: Lisp Interaction,  Up: Running
  131. Running an External Lisp
  132. ========================
  133.    Emacs has facilities for running programs in other Lisp systems. 
  134. You can run a Lisp process as an inferior of Emacs, and pass
  135. expressions to it to be evaluated.  You can also pass changed function
  136. definitions directly from the Emacs buffers in which you edit the Lisp
  137. programs to the inferior Lisp process.
  138.    To run an inferior Lisp process, type `M-x run-lisp'.  This runs the
  139. program named `lisp', the same program you would run by typing `lisp'
  140. as a shell command, with both input and output going through an Emacs
  141. buffer named `*lisp*'.  That is to say, any "terminal output" from
  142. Lisp will go into the buffer, advancing point, and any "terminal
  143. input" for Lisp comes from text in the buffer.  To give input to Lisp,
  144. go to the end of the buffer and type the input, terminated by RET.  The
  145. `*lisp*' buffer is in Inferior Lisp mode, a mode which has all the
  146. special characteristics of Lisp mode and Shell mode (*note Shell
  147. Mode::.).
  148.    For the source files of programs to run in external Lisps, use Lisp
  149. mode.  This mode can be selected with `M-x lisp-mode', and is used
  150. automatically for files whose names end in `.l' or `.lisp', as most
  151. Lisp systems usually expect.
  152.    When you edit a function in a Lisp program you are running, the
  153. easiest way to send the changed definition to the inferior Lisp
  154. process is the key `C-M-x'.  In Lisp mode, this runs the function
  155. `lisp-send-defun', which finds the defun around or following point and
  156. sends it as input to the Lisp process.  (Emacs can send input to any
  157. inferior process regardless of what buffer is current.)
  158.    Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
  159. to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
  160. programs to be run in Emacs): in both modes it has the effect of
  161. installing the function definition that point is in, but the way of
  162. doing so is different according to where the relevant Lisp environment
  163. is found.  *Note Lisp Modes::.
  164. File: emacs,  Node: Abbrevs,  Next: Picture,  Prev: Running,  Up: Top
  165. Abbrevs
  166. *******
  167.    An "abbrev" is a word which "expands", if you insert it, into some
  168. different text.  Abbrevs are defined by the user to expand in specific
  169. ways.  For example, you might define `foo' as an abbrev expanding to
  170. `find outer otter'.  With this abbrev defined, you would be able to
  171. get `find outer otter ' into the buffer by typing `f o o SPC'.
  172.    Abbrevs expand only when Abbrev mode (a minor mode) is enabled. 
  173. Disabling Abbrev mode does not cause abbrev definitions to be
  174. forgotten, but they do not expand until Abbrev mode is enabled again. 
  175. The command `M-x abbrev-mode' toggles Abbrev mode; with a numeric
  176. argument, it turns Abbrev mode on if the argument is positive, off
  177. otherwise.  *Note Minor Modes::.  `abbrev-mode' is also a variable;
  178. Abbrev mode is on when the variable is non-`nil'.  The variable
  179. `abbrev-mode' automatically becomes local to the current buffer when
  180. it is set.
  181.    Abbrev definitions can be "mode-specific"--active only in one major
  182. mode.  Abbrevs can also have "global" definitions that are active in
  183. all major modes.  The same abbrev can have a global definition and
  184. various mode-specific definitions for different major modes.  A mode
  185. specific definition for the current major mode overrides a global
  186. definition.
  187.    Abbrevs can be defined interactively during the editing session. 
  188. Lists of abbrev definitions can also be saved in files and reloaded in
  189. later sessions.  Some users keep extensive lists of abbrevs that they
  190. load in every session.
  191.    A second kind of abbreviation facility is called the "dynamic
  192. expansion".  Dynamic abbrev expansion happens only when you give an
  193. explicit command and the result of the expansion depends only on the
  194. current contents of the buffer.  *Note Dynamic Abbrevs::.
  195. * Menu:
  196. * Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
  197. * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
  198. * Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
  199. * Saving Abbrevs::    Saving the entire list of abbrevs for another session.
  200. * Dynamic Abbrevs::   Abbreviations for words already in the buffer.
  201. File: emacs,  Node: Defining Abbrevs,  Next: Expanding Abbrevs,  Prev: Abbrevs,  Up: Abbrevs
  202. Defining Abbrevs
  203. ================
  204. `C-x +'
  205.      Define an abbrev to expand into some text before point
  206.      (`add-global-abbrev').
  207. `C-x C-a'
  208.      Similar, but define an abbrev available only in the current major
  209.      mode (`add-mode-abbrev').
  210. `C-x -'
  211.      Define a word in the buffer as an abbrev
  212.      (`inverse-add-global-abbrev').
  213. `C-x C-h'
  214.      Define a word in the buffer as a mode-specific abbrev
  215.      (`inverse-add-mode-abbrev').
  216. `M-x kill-all-abbrevs'
  217.      After this command, there are no abbrev definitions in effect.
  218.    The usual way to define an abbrev is to enter the text you want the
  219. abbrev to expand to, position point after it, and type `C-x +'
  220. (`add-global-abbrev').  This reads the abbrev itself using the
  221. minibuffer, and then defines it as an abbrev for one or more words
  222. before point.  Use a numeric argument to say how many words before
  223. point should be taken as the expansion.  For example, to define the
  224. abbrev `foo' as mentioned above, insert the text `find outer otter'
  225. and then type `C-u 3 C-x + f o o RET'.
  226.    An argument of zero to `C-x +' means to use the contents of the
  227. region as the expansion of the abbrev being defined.
  228.    The command `C-x C-a' (`add-mode-abbrev') is similar, but defines a
  229. mode-specific abbrev.  Mode specific abbrevs are active only in a
  230. particular major mode.  `C-x C-a' defines an abbrev for the major mode
  231. in effect at the time `C-x C-a' is typed.  The arguments work the same
  232. as for `C-x +'.
  233.    If the text of the abbrev you want is already in the buffer instead
  234. of the expansion, use command `C-x -' (`inverse-add-global-abbrev')
  235. instead of `C-x +', or use `C-x C-h' (`inverse-add-mode-abbrev')
  236. instead of `C-x C-a'.  These commands are called "inverse" because
  237. they invert the meaning of the argument found in the buffer and the
  238. argument read using the minibuffer.
  239.    To change the definition of an abbrev, just add the new definition.
  240.  You will be asked to confirm if the abbrev has a prior definition. 
  241. To remove an abbrev definition, give a negative argument to `C-x +' or
  242. `C-x C-a'.  You must choose the command to specify whether to kill a
  243. global definition or a mode-specific definition for the current mode,
  244. since those two definitions are independent for one abbrev.
  245.    `M-x kill-all-abbrevs' removes all the abbrev definitions there are.
  246. File: emacs,  Node: Expanding Abbrevs,  Next: Editing Abbrevs,  Prev: Defining Abbrevs,  Up: Abbrevs
  247. Controlling Abbrev Expansion
  248. ============================
  249.    An abbrev expands whenever it is present in the buffer just before
  250. point and a self-inserting punctuation character (SPC, comma, etc.) is
  251. typed.  Most often the way an abbrev is used is to insert the abbrev
  252. followed by punctuation.
  253.    Abbrev expansion preserves case; thus, `foo' expands into `find
  254. outer otter'; `Foo' into `Find outer otter', and `FOO' into `FIND
  255. OUTER OTTER' or `Find Outer Otter' according to the variable
  256. `abbrev-all-caps' (a non-`nil' value chooses the first of the two
  257. expansions).
  258.    These two commands are used to control abbrev expansion:
  259. `M-''
  260.      Separate a prefix from a following abbrev to be expanded
  261.      (`abbrev-prefix-mark').
  262. `C-x ''
  263.      Expand the abbrev before point (`expand-abbrev').  This is
  264.      effective even when Abbrev mode is not enabled.
  265. `M-x unexpand-abbrev'
  266.      Undo last abbrev expansion.
  267. `M-x expand-region-abbrevs'
  268.      Expand some or all abbrevs found in the region.
  269.    You may wish to expand an abbrev with a prefix attached; for
  270. example, if `cnst' expands into `construction', you might want to use
  271. it to enter `reconstruction'.  It does not work to type `recnst',
  272. because that is not necessarily a defined abbrev.  What does work is
  273. to use the command `M-'' (`abbrev-prefix-mark') in between the prefix
  274. `re' and the abbrev `cnst'.  First, insert `re'.  Then type `M-'';
  275. this inserts a minus sign in the buffer to indicate that it has done
  276. its work.  Then insert the abbrev `cnst'; the buffer now contains
  277. `re-cnst'.  Now insert a punctuation character to expand the abbrev
  278. `cnst' into `construction'.  The minus sign is deleted at this point,
  279. because `M-'' left word for this to be done.  The resulting text is
  280. the desired `reconstruction'.
  281.    If you actually want the text of the abbrev in the buffer, rather
  282. than its expansion, you can accomplish this by inserting the following
  283. punctuation with `C-q'.  Thus, `foo C-q -' leaves `foo-' in the buffer.
  284.    If you expand an abbrev by mistake, you can undo the expansion
  285. (replace the expansion by the original abbrev text) with `M-x
  286. unexpand-abbrev'.  `C-_' (`undo') can also be used to undo the
  287. expansion; but first it will undo the insertion of the following
  288. punctuation character!
  289.    `M-x expand-region-abbrevs' searches through the region for defined
  290. abbrevs, and for each one found offers to replace it with its
  291. expansion.  This command is useful if you have typed in text using
  292. abbrevs but forgot to turn on Abbrev mode first.  It may also be
  293. useful together with a special set of abbrev definitions for making
  294. several global replacements at once.  This command is effective even
  295. if Abbrev mode is not enabled.
  296. File: emacs,  Node: Editing Abbrevs,  Next: Saving Abbrevs,  Prev: Expanding Abbrevs,  Up: Abbrevs
  297. Examining and Editing Abbrevs
  298. =============================
  299. `M-x list-abbrevs'
  300.      Print a list of all abbrev definitions.
  301. `M-x edit-abbrevs'
  302.      Edit a list of abbrevs; you can add, alter or remove definitions.
  303.    The output from `M-x list-abbrevs' looks like this:
  304.      (lisp-mode-abbrev-table)
  305.      "dk"           0    "define-key"
  306.      (global-abbrev-table)
  307.      "dfn"           0    "definition"
  308. (Some blank lines of no semantic significance, and some other abbrev
  309. tables, have been omitted.)
  310.    A line containing a name in parentheses is the header for abbrevs
  311. in a particular abbrev table; `global-abbrev-table' contains all the
  312. global abbrevs, and the other abbrev tables that are named after major
  313. modes contain the mode-specific abbrevs.
  314.    Within each abbrev table, each nonblank line defines one abbrev. 
  315. The word at the beginning is the abbrev.  The number that appears is
  316. the number of times the abbrev has been expanded.  Emacs keeps track
  317. of this to help you see which abbrevs you actually use, in case you
  318. decide to eliminate those that you don't use often.  The string at the
  319. end of the line is the expansion.
  320.    `M-x edit-abbrevs' allows you to add, change or kill abbrev
  321. definitions by editing a list of them in an Emacs buffer.  The list
  322. has the same format described above.  The buffer of abbrevs is called
  323. `*Abbrevs*', and is in Edit-Abbrevs mode.  This mode redefines the key
  324. `C-c C-c' to install the abbrev definitions as specified in the
  325. buffer.  The command that does this is `edit-abbrevs-redefine'.  Any
  326. abbrevs not described in the buffer are eliminated when this is done.
  327.    `edit-abbrevs' is actually the same as `list-abbrevs' except that
  328. it selects the buffer `*Abbrevs*' whereas `list-abbrevs' merely
  329. displays it in another window.
  330. File: emacs,  Node: Saving Abbrevs,  Next: Dynamic Abbrevs,  Prev: Editing Abbrevs,  Up: Abbrevs
  331. Saving Abbrevs
  332. ==============
  333.    These commands allow you to keep abbrev definitions between editing
  334. sessions.
  335. `M-x write-abbrev-file'
  336.      Write a file describing all defined abbrevs.
  337. `M-x read-abbrev-file'
  338.      Read such a file and define abbrevs as specified there.
  339. `M-x quietly-read-abbrev-file'
  340.      Similar but do not display a message about what is going on.
  341. `M-x define-abbrevs'
  342.      Define abbrevs from buffer.
  343. `M-x insert-abbrevs'
  344.      Insert all abbrevs and their expansions into the buffer.
  345.    `M-x write-abbrev-file' reads a file name using the minibuffer and
  346. writes a description of all current abbrev definitions into that file.
  347.  The text stored in the file looks like the output of `M-x
  348. list-abbrevs'.  This is used to save abbrev definitions for use in a
  349. later session.
  350.    `M-x read-abbrev-file' reads a file name using the minibuffer and
  351. reads the file, defining abbrevs according to the contents of the file. 
  352. `M-x quietly-read-abbrev-file' is the same except that it does not
  353. display a message in the echo area saying that it is doing its work; it
  354. is actually useful primarily in the `.emacs' file.  If an empty
  355. argument is given to either of these functions, the file name used is
  356. the value of the variable `abbrev-file-name', which is by default
  357. `"~/.abbrev_defs"'.
  358.    Emacs will offer to save abbrevs automatically if you have changed
  359. any of them, whenever it offers to save all files (for `C-x s' or `C-x
  360. C-c').  This feature can be inhibited by setting the variable
  361. `save-abbrevs' to `nil'.
  362.    The commands `M-x insert-abbrevs' and `M-x define-abbrevs' are
  363. similar to the previous commands but work on text in an Emacs buffer. 
  364. `M-x insert-abbrevs' inserts text into the current buffer before point,
  365. describing all current abbrev definitions; `M-x define-abbrevs' parses
  366. the entire current buffer and defines abbrevs accordingly.
  367. File: emacs,  Node: Dynamic Abbrevs,  Prev: Saving Abbrevs,  Up: Abbrevs
  368. Dynamic Abbrev Expansion
  369. ========================
  370.    The abbrev facility described above operates automatically as you
  371. insert text, but all abbrevs must be defined explicitly.  By contrast,
  372. "dynamic abbrevs" allow the meanings of abbrevs to be determined
  373. automatically from the contents of the buffer, but dynamic abbrev
  374. expansion happens only when you request it explicitly.
  375. `M-/'
  376.      Expand the word in the buffer before point as a "dynamic abbrev",
  377.      by searching in the buffer for words starting with that
  378.      abbreviation (`dabbrev-expand').
  379.    For example, if the buffer contains `does this follow ' and you type
  380. `f o M-/', the effect is to insert `follow' because that is the last
  381. word in the buffer that starts with `fo'.  A numeric argument to `M-/'
  382. says to take the second, third, etc. distinct expansion found looking
  383. backward from point.  Repeating `M-/' searches for an alternative
  384. expansion by looking farther back.  After the entire buffer before
  385. point has been considered, the buffer after point is searched.
  386.    Dynamic abbrev expansion is completely independent of Abbrev mode;
  387. the expansion of a word with `M-/' is completely independent of
  388. whether it has a definition as an ordinary abbrev.
  389. File: emacs,  Node: Picture,  Next: Sending Mail,  Prev: Abbrevs,  Up: Top
  390. Editing Pictures
  391. ****************
  392.    If you want to create a picture made out of text characters (for
  393. example, a picture of the division of a register into fields, as a
  394. comment in a program), use the command `edit-picture' to enter Picture
  395. mode.
  396.    In Picture mode, editing is based on the "quarter-plane" model of
  397. text, according to which the text characters lie studded on an area
  398. that stretches infinitely far to the right and downward.  The concept
  399. of the end of a line does not exist in this model; the most you can
  400. say is where the last nonblank character on the line is found.
  401.    Of course, Emacs really always considers text as a sequence of
  402. characters, and lines really do have ends.  But in Picture mode most
  403. frequently-used keys are rebound to commands that simulate the
  404. quarter-plane model of text.  They do this by inserting spaces or by
  405. converting tabs to spaces.
  406.    Most of the basic editing commands of Emacs are redefined by
  407. Picture mode to do essentially the same thing but in a quarter-plane
  408. way.  In addition, Picture mode defines various keys starting with the
  409. `C-c' prefix to run special picture editing commands.
  410.    One of these keys, `C-c C-c', is pretty important.  Often a picture
  411. is part of a larger file that is usually edited in some other major
  412. mode.  `M-x edit-picture' records the name of the previous major mode,
  413. and then you can use the `C-c C-c' command (`picture-mode-exit') to
  414. restore that mode.  `C-c C-c' also deletes spaces from the ends of
  415. lines, unless given a numeric argument.
  416.    The commands used in Picture mode all work in other modes (provided
  417. the `picture' library is loaded), but are not bound to keys except in
  418. Picture mode.  Note that the descriptions below talk of moving "one
  419. column" and so on, but all the picture mode commands handle numeric
  420. arguments as their normal equivalents do.
  421.    Turning on Picture mode calls the value of the variable
  422. `picture-mode-hook' as a function, with no arguments, if that value
  423. exists and is non-`nil'.
  424. * Menu:
  425. * Basic Picture::         Basic concepts and simple commands of Picture Mode.
  426. * Insert in Picture::     Controlling direction of cursor motion
  427.                            after "self-inserting" characters.
  428. * Tabs in Picture::       Various features for tab stops and indentation.
  429. * Rectangles in Picture:: Clearing and superimposing rectangles.
  430. File: emacs,  Node: Basic Picture,  Next: Insert in Picture,  Prev: Picture,  Up: Picture
  431. Basic Editing in Picture Mode
  432. =============================
  433.    Most keys do the same thing in Picture mode that they usually do,
  434. but do it in a quarter-plane style.  For example, `C-f' is rebound to
  435. run `picture-forward-column', which is defined to move point one
  436. column to the right, by inserting a space if necessary, so that the
  437. actual end of the line makes no difference.  `C-b' is rebound to run
  438. `picture-backward-column', which always moves point left one column,
  439. converting a tab to multiple spaces if necessary.  `C-n' and `C-p' are
  440. rebound to run `picture-move-down' and `picture-move-up', which can
  441. either insert spaces or convert tabs as necessary to make sure that
  442. point stays in exactly the same column.  `C-e' runs
  443. `picture-end-of-line', which moves to after the last nonblank
  444. character on the line.  There is no need to change `C-a', as the choice
  445. of screen model does not affect beginnings of lines.
  446.    Insertion of text is adapted to the quarter-plane screen model
  447. through the use of Overwrite mode (*note Minor Modes::.). 
  448. Self-inserting characters replace existing text, column by column,
  449. rather than pushing existing text to the right.  RET runs
  450. `picture-newline', which just moves to the beginning of the following
  451. line so that new text will replace that line.
  452.    Deletion and killing of text are replaced with erasure.  DEL
  453. (`picture-backward-clear-column') replaces the preceding character
  454. with a space rather than removing it.  `C-d' (`picture-clear-column')
  455. does the same thing in a forward direction.  `C-k'
  456. (`picture-clear-line') really kills the contents of lines, but does
  457. not ever remove the newlines from the buffer.
  458.    To do actual insertion, you must use special commands.  `C-o'
  459. (`picture-open-line') still creates a blank line, but does so after
  460. the current line; it never splits a line.  `C-M-o', `split-line',
  461. makes sense in Picture mode, so it is not changed.  LFD
  462. (`picture-duplicate-line') inserts below the current line another line
  463. with the same contents.
  464.    Real deletion can be done with `C-w', or with `C-c C-d' (which is
  465. defined as `delete-char', as `C-d' is in other modes), or with one of
  466. the picture rectangle commands (*note Rectangles in Picture::.).
  467. File: emacs,  Node: Insert in Picture,  Next: Tabs in Picture,  Prev: Basic Picture,  Up: Picture
  468. Controlling Motion after Insert
  469. ===============================
  470.    Since "self-inserting" characters in Picture mode just overwrite and
  471. move point, there is no essential restriction on how point should be
  472. moved.  Normally point moves right, but you can specify any of the
  473. eight orthogonal or diagonal directions for motion after a
  474. "self-inserting" character.  This is useful for drawing lines in the
  475. buffer.
  476. `C-c <'
  477.      Move left after insertion (`picture-movement-left').
  478. `C-c >'
  479.      Move right after insertion (`picture-movement-right').
  480. `C-c ^'
  481.      Move up after insertion (`picture-movement-up').
  482. `C-c .'
  483.      Move down after insertion (`picture-movement-down').
  484. `C-c `'
  485.      Move up and left ("northwest") after insertion 
  486.      (`picture-movement-nw').
  487. `C-c ''
  488.      Move up and right ("northeast") after insertion 
  489.       (`picture-movement-ne').
  490. `C-c /'
  491.      Move down and left ("southwest") after insertion 
  492.      (`picture-movement-sw').
  493. `C-c \'
  494.      Move down and right ("southeast") after insertion 
  495.      (`picture-movement-se').
  496.    Two motion commands move based on the current Picture insertion
  497. direction.  The command `C-c C-f' (`picture-motion') moves in the same
  498. direction as motion after "insertion" currently does, while `C-c C-b'
  499. (`picture-motion-reverse') moves in the opposite direction.
  500. File: emacs,  Node: Tabs in Picture,  Next: Rectangles in Picture,  Prev: Insert in Picture,  Up: Picture
  501. Picture Mode Tabs
  502. =================
  503.    Two kinds of tab-like action are provided in Picture mode. 
  504. Context-based tabbing is done with `M-TAB' (`picture-tab-search'). 
  505. With no argument, it moves to a point underneath the next
  506. "interesting" character that follows whitespace in the previous
  507. nonblank line.  "Next" here means "appearing at a horizontal position
  508. greater than the one point starts out at".  With an argument, as in
  509. `C-u M-TAB', this command moves to the next such interesting character
  510. in the current line.  `M-TAB' does not change the text; it only moves
  511. point.  "Interesting" characters are defined by the variable
  512. `picture-tab-chars', which contains a string whose characters are all
  513. considered interesting.  Its default value is `"!-~"'.
  514.    TAB itself runs `picture-tab', which operates based on the current
  515. tab stop settings; it is the Picture mode equivalent of
  516. `tab-to-tab-stop'.  Normally it just moves point, but with a numeric
  517. argument it clears the text that it moves over.
  518.    The context-based and tab-stop-based forms of tabbing are brought
  519. together by the command `C-c TAB', `picture-set-tab-stops'.  This
  520. command sets the tab stops to the positions which `M-TAB' would
  521. consider significant in the current line.  The use of this command,
  522. together with TAB, can get the effect of context-based tabbing.  But
  523. `M-TAB' is more convenient in the cases where it is sufficient.
  524. File: emacs,  Node: Rectangles in Picture,  Prev: Tabs in Picture,  Up: Picture
  525. Picture Mode Rectangle Commands
  526. ===============================
  527.    Picture mode defines commands for working on rectangular pieces of
  528. the text in ways that fit with the quarter-plane model.  The standard
  529. rectangle commands may also be useful (*note Rectangles::.).
  530. `C-c C-k'
  531.      Clear out the region-rectangle (`picture-clear-rectangle').  With
  532.      argument, kill it.
  533. `C-c C-w R'
  534.      Similar but save rectangle contents in register R first
  535.      (`picture-clear-rectangle-to-register').
  536. `C-c C-y'
  537.      Copy last killed rectangle into the buffer by overwriting, with
  538.      upper left corner at point (`picture-yank-rectangle').  With
  539.      argument, insert instead.
  540. `C-c C-x R'
  541.      Similar, but use the rectangle in register R
  542.       (`picture-yank-rectangle-from-register').
  543.    The picture rectangle commands `C-c C-k'
  544. (`picture-clear-rectangle') and `C-c C-w'
  545. (`picture-clear-rectangle-to-register') differ from the standard
  546. rectangle commands in that they normally clear the rectangle instead of
  547. deleting it; this is analogous with the way `C-d' is changed in Picture
  548. mode.
  549.    However, deletion of rectangles can be useful in Picture mode, so
  550. these commands delete the rectangle if given a numeric argument.
  551.    The Picture mode commands for yanking rectangles differ from the
  552. standard ones in overwriting instead of inserting.  This is the same
  553. way that Picture mode insertion of other text is different from other
  554. modes.  `C-c C-y' (`picture-yank-rectangle') inserts (by overwriting)
  555. the rectangle that was most recently killed, while `C-c C-x'
  556. (`picture-yank-rectangle-from-register') does likewise for the
  557. rectangle found in a specified register.
  558. File: emacs,  Node: Sending Mail,  Next: Rmail,  Prev: Picture,  Up: Top
  559. Sending Mail
  560. ************
  561.    To send a message in Emacs, you start by typing a command (`C-x m')
  562. to select and initialize the `*mail*' buffer.  Then you edit the text
  563. and headers of the message in this buffer, and type another command
  564. (`C-c C-c') to send the message.
  565. `C-x m'
  566.      Begin composing a message to send (`mail').
  567. `C-x 4 m'
  568.      Likewise, but display the message in another window
  569.      (`mail-other-window').
  570. `C-c C-c'
  571.      In Mail mode, send the message and switch to another buffer
  572.      (`mail-send-and-exit').
  573.    The command `C-x m' (`mail') selects a buffer named `*mail*' and
  574. initializes it with the skeleton of an outgoing message.  `C-x 4 m'
  575. (`mail-other-window') selects the `*mail*' buffer in a different
  576. window, leaving the previous current buffer visible.
  577.    Because the mail composition buffer is an ordinary Emacs buffer,
  578. you can switch to other buffers while in the middle of composing mail,
  579. and switch back later (or never).  If you use the `C-x m' command
  580. again when you have been composing another message but have not sent
  581. it, you are asked to confirm before the old message is erased.  If you
  582. answer `n', the `*mail*' buffer is left selected with its old
  583. contents, so you can finish the old message and send it.  `C-u C-x m'
  584. is another way to do this.  Sending the message marks the `*mail*'
  585. buffer "unmodified", which avoids the need for confirmation when `C-x
  586. m' is next used.
  587.    If you are composing a message in the `*mail*' buffer and want to
  588. send another message before finishing the first, rename the `*mail*'
  589. buffer using `M-x rename-buffer' (*note Misc Buffer::.).
  590. * Menu:
  591. * Format: Mail Format.    Format of the mail being composed.
  592. * Headers: Mail Headers.  Details of allowed mail header fields.
  593. * Mode: Mail Mode.        Special commands for editing mail being composed.
  594. File: emacs,  Node: Mail Format,  Next: Mail Headers,  Prev: Sending Mail,  Up: Sending Mail
  595. The Format of the Mail Buffer
  596. =============================
  597.    In addition to the "text" or contents, a message has "header
  598. fields" which say who sent it, when, to whom, why, and so on.  Some
  599. header fields such as the date and sender are created automatically
  600. after the message is sent.  Others, such as the recipient names, must
  601. be specified by you in order to send the message properly.
  602.    Mail mode provides a few commands to help you edit some header
  603. fields, and some are preinitialized in the buffer automatically at
  604. times.  You can insert or edit any header fields using ordinary
  605. editing commands.
  606.    The line in the buffer that says
  607.      --text follows this line--
  608. is a special delimiter that separates the headers you have specified
  609. from the text.  Whatever follows this line is the text of the message;
  610. the headers precede it.  The delimiter line itself does not appear in
  611. the message actually sent.  The text used for the delimiter line is
  612. controlled by the variable `mail-header-separator'.
  613.    Here is an example of what the headers and text in the `*mail*'
  614. buffer might look like.
  615.      To: rms@mc
  616.      CC: mly@mc, rg@oz
  617.      Subject: The Emacs Manual
  618.      --Text follows this line--
  619.      Please ignore this message.
  620. File: emacs,  Node: Mail Headers,  Next: Mail Mode,  Prev: Mail Format,  Up: Sending Mail
  621. Mail Header Fields
  622. ==================
  623.    There are several header fields you can use in the `*mail*' buffer. 
  624. Each header field starts with a field name at the beginning of a line,
  625. terminated by a colon.  It does not matter whether you use upper or
  626. lower case in the field name.  After the colon and optional whitespace
  627. comes the contents of the field.
  628.      This field contains the mailing addresses to which the message is
  629.      addressed.
  630. `Subject'
  631.      The contents of the `Subject' field should be a piece of text
  632.      that says what the message is about.  The reason `Subject' fields
  633.      are useful is that most mail-reading programs can provide a
  634.      summary of messages, listing the subject of each message but not
  635.      its text.
  636.      This field contains additional mailing addresses to send the
  637.      message to, but whose readers should not regard the message as
  638.      addressed to them.
  639. `BCC'
  640.      This field contains additional mailing addresses to send the
  641.      message to, but which should not appear in the header of the
  642.      message actually sent.
  643. `FCC'
  644.      This field contains the name of one file (in Unix mail file
  645.      format) to which a copy of the message should be appended when
  646.      the message is sent.
  647. `From'
  648.      Use the `From' field to say who you are, when the account you are
  649.      using to send the mail is not your own.  The contents of the
  650.      `From' field should be a valid mailing address, since replies
  651.      will normally go there.
  652. `Reply-To'
  653.      Use the `Reply-to' field to direct replies to a different
  654.      address, not your own.  There is no difference between `From' and
  655.      `Reply-to' in their effect on where replies go, but they convey a
  656.      different meaning to the human who reads the message.
  657. `In-Reply-To'
  658.      This field contains a piece of text describing a message you are
  659.      replying to.  Some mail systems can use this information to
  660.      correlate related pieces of mail.  Normally this field is filled
  661.      in by Rmail when you are replying to a message in Rmail, and you
  662.      never need to think about it (*note Rmail::.).
  663. The `To', `CC', `BCC' and `FCC' fields can appear any number of times,
  664. to specify many places to send the message.
  665. The `To', `CC', and `BCC' fields can have continuation lines.  All the
  666. lines starting with whitespace, following the line on which the field
  667. starts, are considered part of the field.  For example,
  668.      To: foo@here, this@there,
  669.        me@gnu.cambridge.mass.usa.earth.spiral3281
  670. If you have a `~/.mailrc' file, Emacs will scan it for mail aliases
  671. the first time you try to send mail in an Emacs session.  Aliases found
  672. in the `To', `CC', and `BCC' fields will be expanded where appropriate.
  673.    If the variable `mail-archive-file-name' is non-`nil', it should be
  674. a string naming a file; every time you start to edit a message to send,
  675. an `FCC' field will be put in for that file.  Unless you remove the
  676. `FCC' field, every message will be written into that file when it is
  677. sent.
  678. File: emacs,  Node: Mail Mode,  Prev: Mail Headers,  Up: Sending Mail
  679. Mail Mode
  680. =========
  681.    The major mode used in the `*mail*' buffer is Mail mode, which is
  682. much like Text mode except that various special commands are provided
  683. on the `C-c' prefix.  These commands all have to do specifically with
  684. editing or sending the message.
  685. `C-c C-s'
  686.      Send the message, and leave the `*mail*' buffer selected
  687.      (`mail-send').
  688. `C-c C-c'
  689.      Send the message, and select some other buffer
  690.      (`mail-send-and-exit').
  691. `C-c C-f C-t'
  692.      Move to the `To' header field, creating one if there is none
  693.      (`mail-to').
  694. `C-c C-f C-s'
  695.      Move to the `Subject' header field, creating one if there is none
  696.      (`mail-subject').
  697. `C-c C-f C-c'
  698.      Move to the `CC' header field, creating one if there is none
  699.      (`mail-cc').
  700. `C-c C-w'
  701.      Insert the file `~/.signature' at the end of the message text
  702.      (`mail-signature').
  703. `C-c C-y'
  704.      Yank the selected message from Rmail (`mail-yank-original'). 
  705.      This command does nothing unless your command to start sending a
  706.      message was issued with Rmail.
  707. `C-c C-q'
  708.      Fill all paragraphs of yanked old messages, each individually
  709.      (`mail-fill-yanked-message').
  710.    There are two ways to send the message.  `C-c C-s' (`mail-send')
  711. sends the message and marks the `*mail*' buffer unmodified, but leaves
  712. that buffer selected so that you can modify the message (perhaps with
  713. new recipients) and send it again.  `C-c C-c' (`mail-send-and-exit')
  714. sends and then deletes the window (if there is another window) or
  715. switches to another buffer.  It puts the `*mail*' buffer at the lowest
  716. priority for automatic reselection, since you are finished with using
  717. it.  This is the usual way to send the message.
  718.    Mail mode provides some other special commands that are useful for
  719. editing the headers and text of the message before you send it.  There
  720. are three commands defined to move point to particular header fields,
  721. all based on the prefix `C-c C-f' (`C-f' is for "field").  They are
  722. `C-c C-f C-t' (`mail-to') to move to the `To' field, `C-c C-f C-s'
  723. (`mail-subject') for the `Subject' field, and `C-c C-f C-c'
  724. (`mail-cc') for the `CC' field.  These fields have special motion
  725. commands because they are the most common fields for the user to want
  726. to edit.
  727.    `C-c C-w' (`mail-signature') adds a standard piece text at the end
  728. of the message to say more about who you are.  The text comes from the
  729. file `.signature' in your home directory.
  730.    When mail sending is invoked from the Rmail mail reader using an
  731. Rmail command, `C-c C-y' can be used inside the `*mail*' buffer to
  732. insert the text of the message you are replying to.  Normally it
  733. indents each line of that message four spaces and eliminates most
  734. header fields.  A numeric argument specifies the number of spaces to
  735. indent.  An argument of just `C-u' says not to indent at all and not
  736. to eliminate anything.  `C-c C-y' always uses the current message from
  737. the `RMAIL' buffer, so you can insert several old messages by
  738. selecting one in `RMAIL', switching to `*mail*' and yanking it, then
  739. switching back to `RMAIL' to select another.
  740.    After using `C-c C-y', the command `C-c C-q'
  741. (`mail-fill-yanked-message') can be used to fill the paragraphs of the
  742. yanked old message or messages.  One use of `C-c C-q' fills all such
  743. paragraphs, each one separately.
  744.    Turning on Mail mode (which `C-x m' does automatically) calls the
  745. value of `text-mode-hook', if it is not void or `nil', and then calls
  746. the value of `mail-mode-hook' if that is not void or `nil'.
  747. File: emacs,  Node: Rmail,  Next: Recursive Edit,  Prev: Sending Mail,  Up: Top
  748. Reading Mail with Rmail
  749. ***********************
  750.    Rmail is an Emacs subsystem for reading and disposing of mail that
  751. you receive.  Rmail stores mail messages in files called Rmail files. 
  752. Reading the message in an Rmail file is done in a special major mode,
  753. Rmail mode, which redefines most letters to run commands for managing
  754. mail.  To enter Rmail, type `M-x rmail'.  This reads your primary mail
  755. file, merges new mail in from your inboxes, displays the first new
  756. message, and lets you begin reading.
  757.    Using Rmail in the simplest fashion, you have one Rmail file
  758. `~/RMAIL' in which all of your mail is saved.  It is called your
  759. "primary mail file".  In more sophisticated usage, you can copy
  760. messages into other Rmail files and then edit those files with Rmail.
  761.    Rmail displays only one message at a time.  It is called the
  762. "current message".  Rmail mode's special commands can do such things
  763. as move to another message, delete the message, copy the message into
  764. another file, or send a reply.
  765.    Within the Rmail file, messages are arranged sequentially in order
  766. of receipt.  They are also assigned consecutive integers as their
  767. "message numbers".  The number of the current message is displayed in
  768. Rmail's mode line, followed by the total number of messages in the
  769. file.  You can move to a message by specifying its message number
  770. using the `j' key (*note Rmail Motion::.).
  771.    Following the usual conventions of Emacs, changes in an Rmail file
  772. become permanent only when the file is saved.  You can do this with `s'
  773. (`rmail-save'), which also expunges deleted messages from the file
  774. first (*note Rmail Deletion::.).  To save the file without expunging,
  775. use `C-x C-s'.  Rmail saves the Rmail file spontaneously when moving
  776. new mail from an inbox file (*note Rmail Inbox::.).
  777.    You can exit Rmail with `q' (`rmail-quit'); this expunges and saves
  778. the Rmail file and then switches to another buffer.  But there is no
  779. need to `exit' formally.  If you switch from Rmail to editing in other
  780. buffers, and never happen to switch back, you have exited.  Just make
  781. sure to save the Rmail file eventually (like any other file you have
  782. changed).  `C-x s' is a good enough way to do this (*note Saving::.).
  783. * Menu:
  784. * Scroll: Rmail Scrolling.   Scrolling through a message.
  785. * Motion: Rmail Motion.      Moving to another message.
  786. * Deletion: Rmail Deletion.  Deleting and expunging messages.
  787. * Inbox: Rmail Inbox.        How mail gets into the Rmail file.
  788. * Files: Rmail Files.        Using multiple Rmail files.
  789. * Output: Rmail Output.         Copying message out to files.
  790. * Labels: Rmail Labels.      Classifying messages by labeling them.
  791. * Summary: Rmail Summary.    Summaries show brief info on many messages.
  792. * Reply: Rmail Reply.        Sending replies to messages you are viewing.
  793. * Editing: Rmail Editing.    Editing message text and headers in Rmail.
  794. * Digest: Rmail Digest.      Extracting the messages from a digest message.
  795. File: emacs,  Node: Rmail Scrolling,  Next: Rmail Motion,  Prev: Rmail,  Up: Rmail
  796. Scrolling Within a Message
  797. ==========================
  798.    When Rmail displays a message that does not fit on the screen, it is
  799. necessary to scroll through it.  This could be done with `C-v', `M-v'
  800. and `M-<', but in Rmail scrolling is so frequent that it deserves to be
  801. easier to type.
  802. `SPC'
  803.      Scroll forward (`scroll-up').
  804. `DEL'
  805.      Scroll backward (`scroll-down').
  806.      Scroll to start of message (`rmail-beginning-of-message').
  807.    Since the most common thing to do while reading a message is to
  808. scroll through it by screenfuls, Rmail makes SPC and DEL synonyms of
  809. `C-v' (`scroll-up') and `M-v' (`scroll-down')
  810.    The command `.' (`rmail-beginning-of-message') scrolls back to the
  811. beginning of the selected message.  This is not quite the same as
  812. `M-<': for one thing, it does not set the mark; for another, it resets
  813. the buffer boundaries to the current message if you have changed them.
  814. File: emacs,  Node: Rmail Motion,  Next: Rmail Deletion,  Prev: Rmail Scrolling,  Up: Rmail
  815. Moving Among Messages
  816. =====================
  817.    The most basic thing to do with a message is to read it.  The way
  818. to do this in Rmail is to make the message current.  You can make any
  819. message current given its message number using the `j' command, but
  820. the usual thing to do is to move sequentially through the file, since
  821. this is the order of receipt of messages.  When you enter Rmail, you
  822. are positioned at the first new message (new messages are those
  823. received since the previous use of Rmail), or at the last message if
  824. there are no new messages this time.  Move forward to see the other
  825. new messages; move backward to reexamine old messages.
  826.      Move to the next nondeleted message, skipping any intervening
  827.      deleted 
  828.       messages (`rmail-next-undeleted-message').
  829.      Move to the previous nondeleted message 
  830.       (`rmail-previous-undeleted-message').
  831. `M-n'
  832.      Move to the next message, including deleted messages
  833.      (`rmail-next-message').
  834. `M-p'
  835.      Move to the previous message, including deleted messages
  836.      (`rmail-previous-message').
  837.      Move to the first message.  With argument N, move to message
  838.      number N (`rmail-show-message').
  839.      Move to the last message (`rmail-last-message').
  840. `M-s REGEXP RET'
  841.      Move to the next message containing a match for REGEXP
  842.      (`rmail-search').  If REGEXP is empty, the last regexp used is
  843.      used again.
  844. `- M-s REGEXP RET'
  845.      Move to the previous message containing a match for REGEXP.  If
  846.      REGEXP is empty, the last regexp used is used again.
  847.    `n' and `p' are the usual way of moving among messages in Rmail. 
  848. They move through the messages sequentially, but skip over deleted
  849. messages, which is usually what you want to do.  Their command
  850. definitions are named `rmail-next-undeleted-message' and
  851. `rmail-previous-undeleted-message'.  If you do not want to skip
  852. deleted messages--for example, if you want to move to a message to
  853. undelete it--use the variants `M-n' and `M-p' (`rmail-next-message'
  854. and `rmail-previous-message').  A numeric argument to any of these
  855. commands serves as a repeat count.
  856.    In Rmail, you can specify a numeric argument by typing the digits. 
  857. It is not necessary to type `C-u' first.
  858.    The `M-s' (`rmail-search') command is Rmail's version of search. 
  859. The usual incremental search command `C-s' works in Rmail, but it
  860. searches only within the current message.  The purpose of `M-s' is to
  861. search for another message.  It reads a regular expression (*note
  862. Regexps::.) nonincrementally, then searches starting at the beginning
  863. of the following message for a match.  The message containing the
  864. match is selected.
  865.    To search backward in the file for another message, give `M-s' a
  866. negative argument.  In Rmail this can be done with `- M-s'.
  867.    It is also possible to search for a message based on labels.  *Note
  868. Rmail Labels::.
  869.    To move to a message specified by absolute message number, use `j'
  870. (`rmail-show-message') with the message number as argument.  With no
  871. argument, `j' selects the first message.  `>' (`rmail-last-message')
  872. selects the last message.
  873.